﻿@{
    ViewBag.Title = "Vehicles";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section Header {
   
    <div class="ui-grid-b" style="padding:1%">
	    <div class="ui-block-a">@Html.ActionLink("Back", "Index", "Profile", null, new { data_icon = "arrow-l", data_role="button"})</div>
	    <div class="ui-block-b"  style="text-align:center">@Html.ActionLink("Home", "Index", "Home", null, new { data_icon = "home", data_iconpos="notext", data_role="button"})</div>
	    <div class="ui-block-c" style="text-align:right"> @Html.Partial("_LogOnPartial")</div>
    </div>
}


<h2>My Vehicles</h2>
<ul data-role="listview" data-inset="true" >
    <li data-role="list-divider">@Html.ActionLink("Add New", "VehicleList", "Profile")</li>
    <li data-role="list-divider">Available Vehicles</li>

@{
    System.Data.DataRowCollection vehicles = (System.Data.DataRowCollection)ViewData["UserVehicles"];
    
    if(vehicles.Count>0){
        <!--Markup to show the vehicles -->
    
        foreach(System.Data.DataRow dr in vehicles){
            <li>
             <a   href="UpdateVehicle?vehicleId=@(dr["VehicleID"].ToString())">
               <h3>@dr["Name"].ToString()</h3>
               <p>
                   @(dr["Make"].ToString() + "-" + dr["Model"].ToString() + "-" + dr["Trim"].ToString())
               </p>
               <p class="ui-li-aside"><strong>@dr["Year"].ToString()</strong></p>
            </a>
            </li>
        }

    }
    else
    {
        <!--Display no vehicles message -->
        <li>No Vehicles found...</li>
    }
    
}
</ul>